import java.awt.Dimension;


public class PLGuiInfo {

	private static PLGuiInfo mInfo;

	Canvas.CanvasIdT mCanvasId = Canvas.CanvasIdT.kMin;
	PLShape.ShapeIdT mShapeId = PLShape.ShapeIdT.kLine;

	private PLGuiInfo() {}

	public static synchronized PLGuiInfo Obj() {
		if (mInfo == null) {
			mInfo = new PLGuiInfo();
		}
		return mInfo;
	}

	// no cloning allowed
	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}

	public void ResetCanvas() {
		switch (mCanvasId) {
			case kDrawing: {
				ResetDrawingMode();
				break;
			}
			case kTraning: {
				//
				ResetTrainingMode();
				break;
			}
		}

		// clear the canvas 
		GetCurCanvas().ClearCanvas();
	}

	public Canvas GetCurCanvas() { return Canvas.Obj();} 

	public Canvas.CanvasIdT GetCurCanvasId() {return mCanvasId;} 

	public void SetCurCanvasId(Canvas.CanvasIdT id) {
		mCanvasId = id;
		ResetCanvas();
	}

	public PLShape.ShapeIdT GetCurShape() { return mShapeId;}
	public void SetCurShape(PLShape.ShapeIdT  id) { mShapeId = id;}

	public Dimension GetDimension(){ return GetCurCanvas().GetDimension();}

	public int GetWidth(){ return GetCurCanvas().getWidth();}
	public int GetHeight(){ return GetCurCanvas().getHeight();}


	// PRIVATE 
	private void ResetDrawingMode() {
		PLExquisiteCorpse game = new PLExquisiteCorpse();

		// in a different thread
		game.Play();
		// add an exit button in a different thread 		
	}

	private void ResetTrainingMode() {
		PLTrain trainer = new PLTrain();

		// in a different thread
		  trainer.Train(); // enable this to train completely
		//trainer.GetPlayerInput(); // enable this to only read player input		
		// trainer.LearnPlayerStyle();
		// add an exit button in a different thread 		
	}
}

